﻿CREATE TABLE [dbo].[USUARIO](
	[IdTrabajador] [int] NOT NULL,
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Password] [nvarchar](max) NOT NULL,
	[IdRol] [int] NOT NULL,
 CONSTRAINT [PK_dbo.USUARIO] PRIMARY KEY CLUSTERED 
(
	[IdTrabajador] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object:  ForeignKey [FK_dbo.USUARIO_dbo.ROL_IdRol]    Script Date: 11/17/2014 00:41:42 ******/
ALTER TABLE [dbo].[USUARIO]  WITH CHECK ADD  CONSTRAINT [FK_dbo.USUARIO_dbo.ROL_IdRol] FOREIGN KEY([IdRol])
REFERENCES [dbo].[ROL] ([ID])
GO

ALTER TABLE [dbo].[USUARIO] CHECK CONSTRAINT [FK_dbo.USUARIO_dbo.ROL_IdRol]
GO
/****** Object:  ForeignKey [FK_dbo.USUARIO_dbo.TRABAJADOR_IdTrabajador]    Script Date: 11/17/2014 00:41:42 ******/
ALTER TABLE [dbo].[USUARIO]  WITH CHECK ADD  CONSTRAINT [FK_dbo.USUARIO_dbo.TRABAJADOR_IdTrabajador] FOREIGN KEY([IdTrabajador])
REFERENCES [dbo].[TRABAJADOR] ([ID])
GO

ALTER TABLE [dbo].[USUARIO] CHECK CONSTRAINT [FK_dbo.USUARIO_dbo.TRABAJADOR_IdTrabajador]
GO
CREATE NONCLUSTERED INDEX [IX_IdRol] ON [dbo].[USUARIO] 
(
	[IdRol] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
GO
CREATE NONCLUSTERED INDEX [IX_IdTrabajador] ON [dbo].[USUARIO] 
(
	[IdTrabajador] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]